;; ---------- ---------- ---------- ---------- ---------- ---------- ----------
;; Acknowledgements:
;;    https://github.com/byuksel/Emacs-as-a-C-Cplusplus-Editor-IDE-settings/
;;        byuksel for the headers.
;;        `gcc -xc++ -E -v -` combined output for my main systems:
;;            /usr/include/c++/5
;;            /usr/include/x86_64-linux-gnu/c++/5
;;            /usr/include/c++/5/backward
;;            /usr/lib/gcc/x86_64-linux-gnu/5/include
;;            /usr/local/include
;;            /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
;;            /usr/include/x86_64-linux-gnu
;;            /usr/include
;;
;;
;; deps:
;;    gcc
;;    gcc/x86_64-linux-gnu/6/
;;
;; emacs deps:
;;    melpa
;;    auto-complete
;;    auto-complete-config
;;    auto-complete-c-headers
;;
;; troubleshooting:
;;    On Debian, gcc might need:
;;        sudo apt-get install --reinstall build-essential
;;
;; ---------- ---------- ---------- ---------- ---------- ---------- ----------

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

; let's define a function which initializes auto-complete-c-headers and gets called for c/c++ hooks
(defun my:ac-c-header-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers)
  (add-to-list 'achead:include-directories '"/usr/lib/gcc/x86_64-linux-gnu/6/include")
  )

;; hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)

(provide 'protoculture-autocomplete)
